﻿
namespace SwtorCalculator {
    using System.Collections.Generic;
    using Talents;

    /// <summary>
    /// Current Character Class
    /// </summary>
    internal static class Character {
        internal enum ItemQuality { None, Cheap, Standard, Premium, Prototype, Artifact, Legendary };

        /* This is so hideous looking */
        internal struct ItemStats {
            internal ItemQuality Quality;
            internal string Name, Slot;
            internal int ItemLevel, Strength, Endurance, Willpower, ForcePower, Defense,
                CriticalChance, CriticalDamage, Accuracy, Expertise, GlanceChance, GlanceAbsorb, Aim, AttackPower,
                Cunning, Hardingess, Presence, SpellHaste, TechPower;

            internal ItemStats( string name, string slot, int iLvl, ItemQuality qual, int str,
                int end, int wil, int forcePow, int def, int critChance, int critDmg,
                int acc, int expt, int glanceChance, int glanceAbsorb, int aim, int attkPow, int cun,
                int hardi, int pres, int spllHaste, int techPow ) {
                Name = name;
                Slot = slot;
                Quality = qual;
                ItemLevel = iLvl;
                Strength = str;
                Endurance = end;
                Willpower = wil;
                ForcePower = forcePow;
                Defense = def;
                CriticalChance = critChance;
                CriticalDamage = critDmg;
                Accuracy = acc;
                Expertise = expt;
                GlanceChance = glanceChance;
                GlanceAbsorb = glanceAbsorb;
                Aim = aim;
                AttackPower = attkPow;
                Cunning = cun;
                Hardingess = hardi;
                Presence = pres;
                SpellHaste = spllHaste;
                TechPower = techPow;
            }
        }


        /// <summary>
        /// Talent Class Object
        /// </summary>
        private static TalentBase _talentSpec;

        /// <summary>
        /// Abilities Class Object
        /// </summary>
        private static Abilities _ability;

        /// <summary>
        /// Stats Class Object
        /// </summary>
        private static Stats _stats;

        /// <summary>
        /// Gets or Sets the Talent Object
        /// </summary>
        internal static TalentBase TalentSpec {
            get { return _talentSpec; }
            set {
                if( value != null )
                    _talentSpec = value;
            }
        }

        /// <summary>
        /// Gets or Sets the Abilities Object
        /// </summary>
        internal static Abilities Ability {
            get { return _ability; }
            set {
                if( value != null )
                    _ability = value;
            }
        }

        /// <summary>
        /// Gets or Sets the Stats Object
        /// </summary>
        internal static Stats Stat {
            get { return _stats; }
            set {
                if( value != null )
                    _stats = value;
            }
        }

        /// <summary>
        /// Gets or Sets a Value Indicating if the Character is Republic or Not
        /// </summary>
        internal static bool IsRepublic { get; set; }

        /// <summary>
        /// Gets or Sets the Class Name
        /// </summary>
        internal static string ClassName { get; set; }

        /// <summary>
        /// Gets or Sets the Advance Class
        /// </summary>
        internal static string AdvanceClass { get; set; }

        /// <summary>
        /// Gets or Sets a Value Indicating if the Character Can Dual Wield
        /// </summary>
        internal static bool CanDualWield { get; set; }

        /// <summary>
        /// Gets or Sets a Value Indicating if the Character is Dual Wielding
        /// </summary>
        internal static bool isDualWield { get; set; }

        private static Dictionary<string, ItemStats> equipped = new Dictionary<string, ItemStats>() {
            { "Head", new ItemStats( "None", "Head", 0, ItemQuality.None, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ) },
            { "Ear", new ItemStats( "None", "Ear", 0, ItemQuality.None, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ) },
            { "Chest", new ItemStats( "None", "Chest", 0, ItemQuality.Standard, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ) },
            { "Wrist", new ItemStats( "None", "Wrist", 0, ItemQuality.None, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ) },
            { "Hand", new ItemStats( "None", "Hand", 0, ItemQuality.Premium, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ) },
            { "Waist", new ItemStats( "None", "Waist", 0, ItemQuality.None, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ) },
            { "Leg", new ItemStats( "None", "Leg", 0, ItemQuality.Prototype, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ) },
            { "Foot", new ItemStats( "None", "Foot", 0, ItemQuality.None, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ) },
            { "Implant", new ItemStats( "None", "Implant", 0, ItemQuality.Artifact, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ) },
            { "RelicOne", new ItemStats( "None", "Relic", 0, ItemQuality.None, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ) },
            { "RelicTwo", new ItemStats( "None", "Relic", 0, ItemQuality.Legendary, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ) },
            { "RelicThree", new ItemStats( "None", "Relic", 0, ItemQuality.None, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ) },
            { "WeaponMH", new ItemStats( "None", "Weapon", 0, ItemQuality.None, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ) },
            { "WeaponOH", new ItemStats( "None", "Weapon", 0, ItemQuality.None, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ) }
        };

        internal static Dictionary<string, ItemStats> EquippedItems {
            get { return equipped; }
            set {
                if( value != null )
                    equipped = value;
            }
        }
    }
}